package com.time.sky.controller;

import com.time.sky.entity.RM;
import com.time.sky.mapper.RMMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/RM")
public class RMController {
    @Autowired
    private RMMapper rmMapper;
    @ResponseBody
    @RequestMapping("/select")
    public List<RM> selectList(){   return rmMapper.selectList(); }
    @RequestMapping("/add")
    public void add(RM rm){
        rmMapper.add(rm);
    }
    @RequestMapping("/delete/{rid}")
    public void delete(@PathVariable("rid") int rid){
        rmMapper.delete(rid);
    }
    @RequestMapping("/get/{rid}")
    public RM getById(@PathVariable("rid") int rid){ return rmMapper.getById(rid); }
    @RequestMapping("/update")
    public void update(RM rm){
        rmMapper.update(rm);
    }
    @RequestMapping("/rows")
    public int rows(){
        return rmMapper.getRowCount();
    }
}
